var dealCtrl  = new XFApp.client();
XFApp.client.prototype.deal = {
		successCode : 10000,	
		manualPayPage : null,
		urlItems : {
			initListURL: basePath+"/deal/page",
		},	
		
		event : function (){			
			_this = this;
			$("#searchBtn").on("click",function(){
				_this.load();
			});
		},	
		
		load : function (){		
            _this = this;
            params = $('#searchForm').serialize();
			if(!!_this.manualPayPage){
				_this.manualPayPage.page("remote",0,params);
			}else{
				_this.manualPayPage = $("#page").page({
				pageSize : 10,
				remote: {
					url: _this.urlItems.initListURL,
			        params: params, 
			        success: function (data, pageIndex) {
			        	if(data.code==_this.successCode){
			        		if(null == data.result 
										|| null == data.result.itemList
											|| data.result.itemList.length < 1){
			        			$("#data_grid").html('<tr><td align="center" colspan="11">暂无数据</td></tr>');
			        		}else{
			        			$("#data_grid").html($("#dataTmp").render(data.result.itemList));
			        		}
			        		
			        	}else{
			        		  window.webDialogUtil.alert("提示",data.msg);
			        	}
			        },
			        error : function(){
			        	if("undefined" == typeof(data)){
			        		window.location.href=basePath;
			        	}
			        	window.webDialogUtil.alert("提示",data.msg);
			        }
				},
				firstBtnText : '首页',
				lastBtnText : '尾页',
				prevBtnText : '上一页',
				nextBtnText : '下一页',
				showInfo : true,
				showJump : true,
				jumpBtnText : '跳转',
				showPageSizes : true,
				infoFormat : '共{pageCount}页'
			});	
		   }			
		},
		
};
$.views.converters({	
	fmoney : function(value) {		
		if(!value){
			return "0.00";
		}		
		return moneyCtrl.money.fmoney(value,2);		
	},
	fpform : function(value) {		
		switch (value){
		case 0 : return "后台管理员";
		case 1 : return "俄信通";
		default : return "未知平台";
		}
	},
	fdtype : function(value) {		
		switch (value){
		case 0 : return "转入";
		case 1 : return "转出";
		default : return "未知";
		}
	},
	fctype : function(value) {		
		switch (value){
		case 0 : return "现金";
		case 1 : return "优惠券";
		default : return "未知";
		}
	}
});
$(function(){	
	dealCtrl.deal.load();
	dealCtrl.deal.event();
});